package com.study.gank.ui.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import com.study.gank.R
import com.study.gank.bean.GankGoods
import com.study.gank.databinding.ItemGirlBinding

/**
 * <pre>
 *     author : xxs
 *     time   : 2021/01/04
 *     desc   :
 * </pre>
 */
class GirlAdapter(private val mDatas: List<GankGoods>) : BaseBindingAdapter<ItemGirlBinding>() {
    override fun onCreateViewHolder(
        parent: ViewGroup,
        viewType: Int
    ): DataBindViewHolder<ItemGirlBinding> {
        return DataBindViewHolder(
            ItemGirlBinding.inflate(
                LayoutInflater.from(parent.context),
                parent,
                false
            )
        )
    }

    override fun getItemCount() = mDatas.size

    override fun onBindViewHolder(holder: DataBindViewHolder<ItemGirlBinding>, position: Int) {
        super.onBindViewHolder(holder, position)
        holder.binding.girl = mDatas[position]
        holder.binding.executePendingBindings()
    }
}